﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLL;
using DAL.Linq.EntityMapper;

namespace DAL.Linq
{
    public class LinqDMHINHTHUCTHANHTOAN_Dao : IDMHINHTHUCTHANHTOAN_Dao
    {

        #region IDao<DMHINHTHUCTHANHTOAN,int> Members

        /// <summary>
        /// Gets a list of all DMHINHTHUCTHANHTOANs.
        /// </summary>
        /// <returns>List of DMHINHTHUCTHANHTOANs.</returns>
        //public IList<DMHINHTHUCTHANHTOAN> GetAll_Users()
        //{
        //    List<DMHINHTHUCTHANHTOAN> lst = null;
        //    using (Invoice db = DataContextFactory.CreateContext())
        //    {
        //        try
        //        {
        //            lst = db.Sp_DMHinhThucThanhToan_GetAll().Select(p => Mapper.ToBusinessObject(p)).ToList();
        //        }
        //        catch { }
        //        finally
        //        {
        //            if (db != null)
        //                db.Dispose();
        //        }
        //    }
        //    return lst;
        //}

        /// <summary>
        /// Gets a specific DMHINHTHUCTHANHTOAN.
        /// </summary>
        /// <param name="maHinhThucThanhToan">Unique MaHinhThucThanhToan identifier.</param>
        /// <returns>DMHINHTHUCTHANHTOAN.</returns>
        public DMHINHTHUCTHANHTOAN GetById(int maHinhThucThanhToan)
        {
            DMHINHTHUCTHANHTOAN dmInfo = null;
            using (Invoice db = DataContextFactory.CreateContext())
            {
                try
                {
                    dmInfo = Mapper.ToBusinessObject(db.Sp_DMHinhThucThanhToan_GetById(maHinhThucThanhToan).FirstOrDefault());
                }
                catch { }
                finally
                {
                    if (db != null)
                        db.Dispose();
                }
            }
            return dmInfo;
        }

        #endregion

        #region IDao<DMHINHTHUCTHANHTOAN,int> Members

        public IList<DMHINHTHUCTHANHTOAN> GetAll()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
